package com.niuzi.filter;

import com.niuzi.util.PropertiesUtil;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author Administrator
 */
@WebFilter(urlPatterns = "/*")
public class Filter006Enocding implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("触发了过滤器！！！");
        request.setCharacterEncoding(PropertiesUtil.getPrperties("req_encoding"));
        response.setCharacterEncoding(PropertiesUtil.getPrperties("resp_encoding"));
        filterChain.doFilter(request,response);
    }

    @Override
    public void destroy() {

    }
}
